'use strict'
const path = require('path');

const port = process.env.port || '8081'

const videoUrl = process.env.VUE_APP_VIDEO_PROXY_TARGET;

const userUrl = process.env.VUE_APP_PROXY_TARGET;

const barrageUrl = process.env.VUE_APP_BARRAGE_PROXY_TARGET;

module.exports = {
  // 基本路径 baseURL已经过时
  publicPath: '/',
  // 输出文件目录
  outputDir: 'dist',
  // eslint-loader 是否在保存的时候检查
  lintOnSave: false,
  // use the full build with in-browser compiler?
  // https://vuejs.org/v2/guide/installation.html#Runtime-Compiler-vs-Runtime-only
  // compiler: false,
  // webpack配置
  // see https://github.com/vuejs/vue-cli/blob/dev/docs/webpack.md
  chainWebpack: () => { },
  configureWebpack:() =>{ },
  // vue-loader 配置项
  // https://vue-loader.vuejs.org/en/options.html
  // vueLoader: {},
  // 生产环境是否生成 sourceMap 文件
  productionSourceMap: false,
  // css相关配置

  // use thread-loader for babel & TS in production build
  // enabled by default if the machine has more than 1 cores

  // webpack-dev-server 相关配置
  devServer: {

    /**
     * 代理路径需要注意 路径中若包含多个代理路径 需要将你代理的路径上至其他路径的上层
     */
    proxy: {
      
      '/video': {
        target: `${videoUrl}`,
        changeOrigin: true,
        ws: true,
        secure: false,
      },
      '/user':{
        target: `${userUrl}`,
        changeOrigin: true,
        ws: true,
        secure: false,
      },
      '/barrage': {
        target: `${barrageUrl}`,
        changeOrigin: true,
        ws: true,
        secure: false,
      }
    }
  },
}